<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<title>批量激活</title>
<%@ include file="/WEB-INF/jsp/common/common.jsp"%>
<link rel="stylesheet" href="css/zTreeStyle/zTreeStyle.css">
<link rel="stylesheet" href="css/jquery.datetimepicker.css" type="text/css" />
<link rel="stylesheet" href="css/poshytip/tip-yellowsimple/tip-yellowsimple.css" type="text/css" />
<script type="text/javascript" src="js/jquery.datetimepicker.js"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script src="js/jquery.divbox.js" type="text/javascript"></script>
<script src="js/json2.js" type="text/javascript"></script>
<script type="text/javascript" src="js/poshytip/jquery.poshytip.js"></script>
<script type="text/javascript" src="js/checkPppUnit.js"></script>
<script type="text/javascript" src="js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="js/jquery.ztree.excheck-3.5.js"></script>
<style type="text/css">
.scroll_body {
    height: 350px;
    overflow: scroll;
    overflow-x: hidden;
    padding: 20px 100px 0;
    margin-bottom: 20px;
}
.setp {
    margin-bottom: 20px
}
.input_text {
    width: 180px;
}
.insLineC{
    border-bottom: 1px solid #d7dce4;
    margin-top:10px;
    margin-bottom: 10px;
}
.td_label {
    text-align: right;
    padding-right: 10px;
}
.dialogTitle {
    height: 31px;
    line-height: 31px;
    padding-left: 10px;
    color: #333;
    font-weight: bold;
    font-size: 14px;
    text-align:center
}
</style>
<script type="text/javascript">
var DMY_DESC,flag;
var infos = new Array();
var idStr;
var MAX_DAYS;
var MIN_DAYS;
var UNIR_PP;
var MAX_DELAY_DAY;
var MIN_DELAY_DAY;
var INSTANT;
var PPP_UNIT;
var global_SPECIAL_INFO;
var riskMainType;
var pricelessType;

//-------激活卡模板弹窗-------
//打开激活卡窗口
function openTempDiv(pageIndex,obj){
	debugger
	if(infos.length>0) {
		$.message("error","有投保信息,不允许更改卡模板!");
	}else{
	    $('#search_id').val('');
	    $('#search_name').val('');
	    $("#"+obj.id).blur();
	    queryCarTemplate(pageIndex)
	}
}
//调用拼接参数的方法，并执行查询
function queryCarTemplate(pageIndex){
    var id = $('#search_id').val();
    var name = $('#search_name').val();
    queryAllProds({size:8,current:pageIndex,id: id, name: name});
}
function queryAllProds(param){
    $.openLoading_jhk();
    $.ajax({
        url : "activatedCard/querycarddefine",
        type : 'POST',
        async : true,
        data:param,
        dataType:'json',
        success:function(page){
            $.closeLoading();
            if($.validate(page))return;
            var radioObj ="<input class='input_fxk' name='tempRadio' type='radio' value=''>";
            var fieldNames = "name,id,pricelessType@TDH,modalPremamtPp@TDH,planNo@TDH";
            var tableContent = creatTable1(fieldNames,page,radioObj);
              var tableObj = $("#templetTable");
              tableObj.find("tbody").remove();
              tableObj.append(tableContent);
            var strPage = creatChannelPage(page.current,6,page.maxPage,"72");
            var pageDIV = $("#templetpageDIV");
            pageDIV[0].innerHTML="";
            pageDIV.append(strPage);
            $("#addtempletDiv").OpenDiv();
            bindradio();
        }
    });
}
$(function(){
	MAX_DAYS=$("#MAX_DAYS").val();
	MIN_DAYS=$("#MIN_DAYS").val();
	UNIR_PP=$("#UNIR_PP").val();
	MAX_DELAY_DAY=$("#MAX_DELAY_DAY").val();
	MIN_DELAY_DAY=$('#MIN_DELAY_DAY').val();
	INSTANT=$("#INSTANT").val();
	PPP_UNIT=$("#PPP_UNIT").val();
	global_SPECIAL_INFO=$("#global_SPECIAL_INFO").val();
	riskMainType=$("#riskMainType").val();
	pricelessType=$("#pricelessType").val();
    initProgressBar();
    var stagNo=$("#stagNo").val();
    if(stagNo.length>0){
    	infos=JSON.parse('${insuredList}');
    	$("#planName").val('${prodInfo.planName}');
    	$("#cardDefineName").val('${prodInfo.name}');
        $("#cardDefineId").val('${prodInfo.id}');
        $("#totPremamt").val('${prodInfo.stringTotPremamt}');
    	loadInsuredInfo(infos);
    }
    $('input,select').poshytip({
        className: 'tip-yellowsimple',
        showOn: 'none',
        alignTo: 'target',
        alignX: 'right',
        offsetX: 20,
        offsetY: -26,
        showTimeout: 100
    });
    // lfd changed 激活卡弹窗将tip添加到弹窗内 20180919 ---- start
    $('#addAppInfo input').poshytip({
        className : 'tip-yellowsimple',
        showOn : 'none',
        alignTo : 'target',
        alignX : 'right',
        offsetX : 20,
        offsetY : -26,
        showTimeout : 100,
        setEle: '#addAppInfo' // 被插入到的标签
    });
    $('#addAppInfo select').poshytip({
        className : 'tip-yellowsimple',
        showOn : 'none',
        alignTo : 'target',
        alignX : 'right',
        offsetX : 20,
        offsetY : -26,
        showTimeout : 100,
        setEle: '#addAppInfo' // 被插入到的标签
    });
    // lfd changed 激活卡弹窗将tip添加到弹窗内 20180919 ---- end
    $('.notNullClass').bind('change',function(){
        if($(this).val()!=''){
            $(this).css('border','1px solid #c3c3c3');
            $(this).poshytip('hide');
            if($(this).attr('id')=='chassisNum'){
                $('#plateNum').css('border','1px solid #c3c3c3');
                $('#plateNum').poshytip('hide');
            }
        }
        
    });
    //出生日期初始化
    $('#clientBir1,#clientBir2').datetimepicker({lang:'ch',validateOnBlur:false,timepicker:false,format:'Y-m-d',maxDate:'0',onChangeDateTime:changeDate,scrollMonth:false,scrollTime:false,scrollInput:false});
    //点击即时起保引起时间显示
    /* $(".realSignFlag").bind('click',function(){
        if($(this).val()=='Y'){
            $('#effDate').datetimepicker({lang:'ch',validateOnBlur:false,timepicker:true,format:'Y-m-d H:00:00',minDate:'0',minTime:'0',onChangeDateTime:changeTermDate,scrollMonth:false,scrollTime:false});
            $('#effDate').val(getDefaultDate(new Date(),0,1));
        }else{
            $('#effDate').datetimepicker({lang:'ch',validateOnBlur:false,timepicker:false,format:'Y-m-d H:00:00',minDate:'0',minTime:'0',onChangeDateTime:changeTermDate,scrollMonth:false,scrollTime:false});
            $('#effDate').val(getDefaultDate(new Date(),0,1));
        }
        
        var dayCount = $("#dayCount").val();
        var effDate =$('#effDate').val(); 
        var date = new Date(effDate.replace(/-/g, "/"));
        effDate = effDate+"";
        if(PPP_UNIT=='y'){
            date.calTermDateByMonthOrYear(effDate,'Y',dayCount,$(this).val());
        }else if(PPP_UNIT=='m'){
            date.calTermDateByMonthOrYear(effDate,'M',dayCount,$(this).val());
        }else{
            $("#termDate").val(getDefaultDate(new Date(),$("#dayCount").val(),1));
        }
    }); */
    //投保人与被保人关系 选择与被保人关系清空被保人信息
    $("#relWithInsured1").bind('change',function(){
        var relWithInsured1 = $(this).val();
        if(relWithInsured1=='01'){
            $(".appInsuredClass").hide();
        }else{
            $(".appInsuredClass").show();
        }
        $("#clientName2").val('');
        $("#idType").get(0).selectedIndex=0;
        $("#idNo").val('');
        $("#clientBir2").val('');
        $("#clientTel2").val('');
        $("input[name='sex2']:checked").removeAttr("checked");
        $("#workIdBbr").val('');
        $("#workNameBbr").val('');
    });
    //电子邮箱校验
    $(".email1").bind('change',function(){
        var email1 = $(this).val();
        if(email1!=''){
            var emailReg1 = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/g;
            if(emailReg1.test(email1)){
                $(this).css('border','1px solid #c3c3c3');
                $(this).poshytip('hide');
            }else{
                $(this).css('border','1px solid red');
                $(this).poshytip('update', '电子邮箱格式错误');
                $(this).poshytip('show'); 
            }
        }else{
            $(this).css('border','1px solid #c3c3c3');
            $(this).poshytip('hide');
        }
    });
    //投保人证件类型
    $('#certificateType').change(function(){
        //$('#certificateCode').val('');
        if($(this).val()!="01"){
           $('#certificateCode').css('border','1px solid #c3c3c3');
           $('#certificateCode').poshytip('hide'); 
        }
     });
    //被保人证件类型
    $('#idType').change(function(){
        if($(this).val()!="01"){
            $("#idNo").css('border','1px solid #c3c3c3');
            $("#idNo").poshytip('hide');
        }
    });
    //投保人身份证
    $("#certificateCode").bind('change',function(){
        var cc = $(this).val();
        if($("#certificateType").val()=='01'){
            if(identityCodeValid(cc,'certificateCode')){
                $('#certificateCode').css('border','1px solid #c3c3c3');
                $('#certificateCode').poshytip('hide');
                if(cc.length==15){
                    $("#clientBir1").val("19"+cc.substr(6,2)+"-"+cc.substr(8,2)+"-"+cc.substr(10,2));
                    if (parseInt(cc.substr(13, 1)) % 2 == 1) {
                        $("#sexId1").prop('checked',true);
                    } else {
                        $("#sexId2").prop('checked',true);
                    } 
                }
                if(cc.length==18){
                    $("#clientBir1").val(cc.substr(6,4)+"-"+cc.substr(10,2)+"-"+cc.substr(12,2));
                    if (parseInt(cc.substr(16, 1)) % 2 == 1) {
                        $("#sexId1").prop('checked',true);
                    } else {
                        $("#sexId2").prop('checked',true);
                    } 
                }
                $("#clientBir1").css('border','1px solid #c3c3c3');
                $("#clientBir1").poshytip('hide'); 
                $("#sexId2").poshytip('hide'); 
            }
        }else if($("#certificateType").val()=='05'&&cc.length==18){
            $('#certificateCode').css('border','1px solid #c3c3c3');
            $('#certificateCode').poshytip('hide');
            if(identityCodeValidToBack(cc)){
                $("#clientBir1").val(cc.substr(6,4)+"-"+cc.substr(10,2)+"-"+cc.substr(12,2));
                if (parseInt(cc.substr(16, 1)) % 2 == 1) {
                    $("#sexId1").prop('checked',true);
                } else {
                    $("#sexId2").prop('checked',true);
                } 
            }
        }else{
            $('#certificateCode').css('border','1px solid #c3c3c3');
            $('#certificateCode').poshytip('hide');
        }
    });
    //车辆性质
    $("#mainVehicleNature").bind('change',function(){
        if(riskMainType == '9' || riskMainType == '2'){
            var mainVehicleNature = $(this).val();
            if(mainVehicleNature==''){
                $(this).css('border','1px solid red');
                $(this).poshytip('update', '请填写车辆性质');
                $(this).poshytip('show'); 
                return ;
            }else{
                $(this).css('border','1px solid #c3c3c3');
                $(this).poshytip('hide'); 
            }
        }
    });
    //发车时间
    $("#departureTime").bind('change',function(){
        if(riskMainType == '7'){
            var departureTime = $(this).val();
            if(departureTime==''){
                $(this).css('border','1px solid red');
                $(this).poshytip('update', '请选择发车时间');
                $(this).poshytip('show'); 
                return ;
            }else{
                var now = new Date;
                now.setMinutes (now.getMinutes () + 10);
                var nowDate=now.getFullYear()+"-"+(((now.getMonth()+1)<10)?("0"+(now.getMonth()+1)):(now.getMonth()+1))+"-"+comple_Zero(now.getDate())+" "+comple_Zero(now.getHours())+":"+comple_Zero(now.getMinutes())+":00";
                if(compareTo(nowDate,departureTime)){
                    $(this).css('border','1px solid #c3c3c3');
                    $(this).poshytip('hide'); 
                }else{
                    $(this).css('border','1px solid red');
                    $(this).poshytip('update', '发车时间要大于系统时间');
                    $(this).poshytip('show'); 
                    return ;
                }
            }
        }
    });
    //到达时间
    $("#arrivalTime").bind('change',function(){
        if(riskMainType == '7'){
            var arrivalTime = $(this).val();
            if(arrivalTime==''){
                $(this).css('border','1px solid red');
                $(this).poshytip('update', '请选择到达时间');
                $(this).poshytip('show'); 
                return ;
            }else{
                var now = new Date;
                now.setMinutes (now.getMinutes () + 10);
                var nowDate=now.getFullYear()+"-"+(((now.getMonth()+1)<10)?("0"+(now.getMonth()+1)):(now.getMonth()+1))+"-"+comple_Zero(now.getDate())+" "+comple_Zero(now.getHours())+":"+comple_Zero(now.getMinutes())+":00";
                if(compareTo(nowDate,arrivalTime)){
                    $(this).css('border','1px solid #c3c3c3');
                    $(this).poshytip('hide'); 
                }else{
                    $(this).css('border','1px solid red');
                    $(this).poshytip('update', '到达时间要大于系统时间');
                    $(this).poshytip('show'); 
                    return ;
                }
            }
        }
    });
    //被保人身份证
    $("#idNo").bind('change',function(){ 
        var cc = $(this).val();
        if($("#idType").val()=='01'){
            if(identityCodeValid(cc,'idNo')){
                $('#idNo').css('border','1px solid #c3c3c3');
                $('#idNo').poshytip('hide');
                if(cc.length==15){
                    $("#clientBir2").val("19"+cc.substr(6,2)+"-"+cc.substr(8,2)+"-"+cc.substr(10,2));
                    if (parseInt(cc.substr(13, 1)) % 2 == 1) {
                        $("#sexId3").prop('checked',true);
                    } else {
                        $("#sexId4").prop('checked',true);
                    } 
                }
                if(cc.length==18){
                    $("#clientBir2").val(cc.substr(6,4)+"-"+cc.substr(10,2)+"-"+cc.substr(12,2));
                    if (parseInt(cc.substr(16, 1)) % 2 == 1) {
                        $("#sexId3").prop('checked',true);
                    } else {
                        $("#sexId4").prop('checked',true);
                    } 
                }
                $('#clientBir2,#sexId4').css('border','1px solid #c3c3c3');
                $('#clientBir2,#sexId4').poshytip('hide');
            }
        }else if($("#idType").val()=='05'&&cc.length==18){
            $('#idNo').css('border','1px solid #c3c3c3');
            $('#idNo').poshytip('hide');
            if(identityCodeValidToBack(cc)){
                $("#clientBir2").val(cc.substr(6,4)+"-"+cc.substr(10,2)+"-"+cc.substr(12,2));
                if (parseInt(cc.substr(16, 1)) % 2 == 1) {
                    $("#sexId3").prop('checked',true);
                } else {
                    $("#sexId4").prop('checked',true);
                } 
                $('#clientBir2,#sexId4').css('border','1px solid #c3c3c3');
                $('#clientBir2,#sexId4').poshytip('hide');
            }
        }else{
            $('#idNo').css('border','1px solid #c3c3c3');
            $('#idNo').poshytip('hide');
        }
    });
    //天数改变引起终保日期改变
    $("#dayCount").bind('change',function() {
        var dayCount = $(this).val();
        if (dayCount == '') {
            $(this).css('border', '1px solid red');
            $(this).poshytip('update', '请填写' + DMY_DESC);
            $(this).poshytip('show');
            return;
        }
        if (isNaN(dayCount)) {
            $(this).css('border', '1px solid red');
            $(this).poshytip('update', DMY_DESC + '应为整数');
            $(this).poshytip('show');
            return;
        }
        if (dayCount-MIN_DAYS<0) {
            $(this).css('border', '1px solid red');
            $(this).poshytip('update',
                    DMY_DESC + "最小为" + MIN_DAYS);
            $(this).poshytip('show');
            return;
        }
        var MAXDAY = MAX_DAYS;
        if (MAX_DAYS == 365)
            MAXDAY = 366;
        if (dayCount-MAXDAY>0) {
            $(this).css('border', '1px solid red');
            $(this).poshytip('update',
                    DMY_DESC + "最大为" + MAX_DAYS);
            $(this).poshytip('show');
            return;
        }
    
        var effDate = $("#effDate").val();
        var dateCur = new Date(effDate.replace(/-/g, "/"));
        if (dayCount == 366 && !isRunYear(dateCur)) {
            $(this).css('border', '1px solid red');
            $(this).poshytip('update', "平年保险天数最大为365天");
            $(this).poshytip('show');
            return;
        }
    
        $(this).css('border', '1px solid #c3c3c3');
        $(this).poshytip('hide');
        var effDate = $("#effDate").val();
        if (dayCount != '' && effDate.length == 19) {
            /* var realSignFlag = $(
                    "input[name='realSignFlag']:checked")
                    .val(); */
            var date = new Date(effDate.replace(/-/g, "/"));
            effDate = effDate + "";
            if (PPP_UNIT == 'y') {
                date.calTermDateByMonthOrYear(effDate, 'Y',
                        dayCount, 'N');
            } else if (PPP_UNIT == 'm') {
                date.calTermDateByMonthOrYear(effDate, 'M',
                        dayCount, 'N');
            } else {
                $("#termDate").val(
                        getDefaultDate(date, dayCount, 0));
            }
        }
    });
});
function changeTbrIdType(){
	var idType=$("#appNature").val();
	var s = document.getElementById("certificateType").options;
	s.length=0;
	if(idType=="1"){
		var id=${id01};
		for(var i in id){
		   	s.add(new Option(id[i].codeName,id[i].code));
		}
	}else if(idType=="5"){
		var id=${id03};
		for(var i in id){
			s.add(new Option(id[i].codeName,id[i].code));
		}
	}else{
		var id=${id02};
		for(var i in id){
			s.add(new Option(id[i].codeName,id[i].code));
		}
	}
}
function initProgressBar(){
    //进度条处理
    if(pricelessType=='1'){
         stepConObj.curStepIndex=1;//当前已完成索引位置
         stepConObj.stepContentFlag="2";//1非见费和2见费标识
         stepControl(stepConObj);
    }else{
         stepConObj.curStepIndex=1;//当前已完成索引位置
         stepConObj.stepContentFlag="1";//1非见费和2见费标识
         stepControl(stepConObj);
    }
}
//-------激活卡模板弹窗-------
/* 选择高亮 */
function bindradio(){
    $("input[name='tempRadio']").click(function(){
        $("input[name='tempRadio']").parent().parent().removeClass("table_highlighter");
        $(this).parent().parent().addClass("table_highlighter");
       });
}
//统一 关闭  窗口
function closeCurrentDIV(obj){	
    $("#"+obj).CloseDiv();
    if(obj=='addAppInfo'){
        $("#cardNo").css('border','1px solid #c3c3c3');
        $('#cardNo').poshytip('hide');
        $(".cardPw").css('border','1px solid #c3c3c3');
        $('.cardPw').poshytip('hide');
        $("#dayCount").css('border','1px solid #c3c3c3');
        $('#dayCount').poshytip('hide');
        $("#effDate").css('border','1px solid #c3c3c3');
        $('#effDate').poshytip('hide');
        $("#plateNum").css('border','1px solid #c3c3c3');
        $('#plateNum').poshytip('hide');
        $("#seatNum").css('border','1px solid #c3c3c3');
        $('#seatNum').poshytip('hide');
        /*$("#useNature").css('border','1px solid #c3c3c3');
        $('#useNature').poshytip('hide');*/
        $("#departureTime").css('border','1px solid #c3c3c3');
        $('#departureTime').poshytip('hide');
        $("#arrivalTime").css('border','1px solid #c3c3c3');
        $('#arrivalTime').poshytip('hide');
        $("#departureTime").css('border','1px solid #c3c3c3');
        $('#departureTime').poshytip('hide');
        $("#vehicle").css('border','1px solid #c3c3c3');
        $('#vehicle').poshytip('hide');
        $("#ticketNo").css('border','1px solid #c3c3c3');
        $('#ticketNo').poshytip('hide');
        $("#departureStation").css('border','1px solid #c3c3c3');
        $('#departureStation').poshytip('hide');
        $("#arrivalStation").css('border','1px solid #c3c3c3');
        $('#arrivalStation').poshytip('hide');
        $("#mainVehicleNature").css('border','1px solid #c3c3c3');
        $('#mainVehicleNature').poshytip('hide');
        $("#clientName1").css('border','1px solid #c3c3c3');
        $('#clientName1').poshytip('hide');
        $("#certificateType").css('border','1px solid #c3c3c3');
        $('#certificateType').poshytip('hide');
        $("#certificateCode").css('border','1px solid #c3c3c3');
        $('#certificateCode').poshytip('hide');
        $(".email1").css('border','1px solid #c3c3c3');
        $('.email1').poshytip('hide');
        $("#linkmanTel1").css('border','1px solid #c3c3c3');
        $('#linkmanTel1').poshytip('hide');
        $("#clientBir1").css('border','1px solid #c3c3c3');
        $('#clientBir1').poshytip('hide');
        $("#sexId2").css('border','1px solid #c3c3c3');
        $('#sexId2').poshytip('hide');
        $("#relWithInsured1").css('border','1px solid #c3c3c3');
        $('#relWithInsured1').poshytip('hide');
        $("#clientName2").css('border','1px solid #c3c3c3');
        $('#clientName2').poshytip('hide');
        $("#idType").css('border','1px solid #c3c3c3');
        $('#idType').poshytip('hide');
        $("#clientBir2").css('border','1px solid #c3c3c3');
        $('#clientBir2').poshytip('hide');
        $("#idNo").css('border','1px solid #c3c3c3');
        $('#idNo').poshytip('hide');
        $("#sexId4").css('border','1px solid #c3c3c3');
        $('#sexId4').poshytip('hide');
    }
}
function closeCurrentDIV2(obj){
    $("#"+obj).CloseDiv2();
}
// lfd added 职业类型弹窗bug
function closeCurrentDIV4(obj, ele){
    $("#"+obj).CloseDiv4(ele);
}
//点击“确定” ，选择 模板
function chooseTemp(){
  var selectedTemp= $(".table_highlighter");
  if(selectedTemp.length==0){
    $.message("error", "请选择一个激活卡定义");
    return;
  }
  var id = selectedTemp.children()[2].innerHTML;//模板代码
  var name = selectedTemp.children()[1].innerHTML;//模板代码
  //console.log(selectedTemp);
  $('#cardDefineId').val(id);
  $('#cardDefineName').val(name);
  $('#planNo').val(selectedTemp.children()[5].innerHTML);
  pricelessType=selectedTemp.children()[3].innerHTML;
  $("#totPremamt").val(selectedTemp.children()[4].innerHTML);
  closeCurrentDIV('addtempletDiv');
  initProgressBar();
  queryPlanAndProd();
  judgeStarIsHidden();//非必传字段，隐藏红*
}
//判断必传(*)标志是否显示
function judgeStarIsHidden(){
	if(riskMainType=="2" || riskMainType=="9" ){
        $("#clientBir1Span").hide();
        $("#sexSpan").hide();
        $("#nationalitySpan").hide();
	}else{
		$("#clientBir1Span").show();
        $("#sexSpan").show();
        $("#nationalitySpan").show();
	}
}
//点击确定后带出方案信息和产品信息
function queryPlanAndProd() {
    var planNo=$("#planNo").val();
    var id=$("#cardDefineId").val();
    var name=$("#cardDefineName").val();
    var totPremamt=$("#totPremamt").val();
    $.openLoading_jhk();
    $.ajax({
        url : "activatedCard/queryProdInfoByPlanNo",
        type : 'POST',
        async : true,
        data:{planNo:planNo,pricelessType:pricelessType,id:id,name:name,modalPremamtPp:totPremamt},
        dataType:'json',
        success:function(result){
            $.closeLoading();
            //if($.validate(result))return;
            var dataStr;
            if("fail"==result.result){
                $.message("error", "系统错误,请联系管理员");
            }else if("success"==result.result){
                dataStr=result.data;
                $("#planName").val(dataStr.planName);
                $("#partnerNo").val(dataStr.partnerNo);
                $("#MAX_DAYS").val(dataStr.maxDays);
                $("#MIN_DAYS").val(dataStr.minDays);
                $("#UNIR_PP").val(dataStr.unirPp);
                $("#MAX_DELAY_DAY").val(dataStr.maxDelayDay);
                $("#INSTANT").val(dataStr.instant);
                $("#PPP_UNIT").val(dataStr.pppUnit);
                $("#global_SPECIAL_INFO").val(dataStr.specialInfo);
                $("#riskMainType").val(dataStr.riskMainType);
                MAX_DAYS=$("#MAX_DAYS").val();
                MIN_DAYS=$("#MIN_DAYS").val();
                vUNIR_PP=$("#UNIR_PP").val();
                MAX_DELAY_DAY=$("#MAX_DELAY_DAY").val();
                INSTANT=$("#INSTANT").val();
                PPP_UNIT=$("#PPP_UNIT").val();
                global_SPECIAL_INFO=$("#global_SPECIAL_INFO").val();
                riskMainType=$("#riskMainType").val();
                pricelessType=$("#pricelessType").val();
                judgeStarIsHidden();
            }else if("error"==result.result){
                $('#cardDefineId').val('');
                $('#cardDefineName').val('');
                $('#planNo').val('');
                $("#totPremamt").val('');
                $.message("error", result.message);
            }
        }
    });
}
function initData(){
    if(PPP_UNIT=='y'){
        DMY_DESC = '保险年数：';
    }else if(PPP_UNIT=='m'){
        DMY_DESC = '保险月数：';
    }else{
        DMY_DESC = '保险天数：';
    }

    //驾乘险时不显示被保人信息
   	   if(riskMainType=='2' && global_SPECIAL_INFO=='0'){
        //初始化被保人显隐藏
        var relWithInsuredFlag = $('#relWithInsuredFlag').val();
        if(relWithInsuredFlag=='1'){
            $(".appInsuredClass").hide();
        }else{
        	$(".appInsuredClass").show();
        	$("#commonInsure").show();
        } 
        var relWithInsured1 = $("#relWithInsured1").val();
        if(relWithInsured1=='01'){
            $(".appInsuredClass").hide();
        }else{
        	$(".appInsuredClass").show();
        }
    }else if(riskMainType=='2' && global_SPECIAL_INFO==''){
    	$(".appInsuredClass").hide();
    	$("#commonInsure").hide();
    }else{
    	$(".appInsuredClass").show();
    	$("#commonInsure").show();
    }   
    //驾乘险
    if(riskMainType == '2' && global_SPECIAL_INFO == ''){
        $("[name='drivingInfo']").show();
        $("[name='drivingInfo1']").show();
        $("#drivingShow").show();
    }else if(riskMainType == '2' && global_SPECIAL_INFO == '0'){	
        $("[name='drivingInfo']").hide();
        $("[name='drivingInfo1']").hide();
        $("#drivingShow").hide();
    }else{
    	$("[name='drivingInfo']").hide();
        $("#drivingShow").hide();
    }
    //驾意险
    if(riskMainType == '9' || (riskMainType == '2' && global_SPECIAL_INFO == '0')){
        $("#mainVehicleNatureId ").show();
    }else{
        $("#mainVehicleNatureId ").hide();
    }
    //乘意险
    if(riskMainType == '7'){
        $("[name='ticketInfo']").show();
        $('#departureTime').datetimepicker({lang:'ch',validateOnBlur:false,timepicker:true,step:1,format:'Y-m-d H:i:00',minDate:'0',onChangeDateTime:clearDepartureTime,scrollMonth:false,scrollTime:false});
        $('#arrivalTime').datetimepicker({lang:'ch',validateOnBlur:false,timepicker:true,step:1,format:'Y-m-d H:i:00',minDate:'0',onChangeDateTime:clearArrivalTime,scrollMonth:false,scrollTime:false});
    }else{
        $("[name='ticketInfo']").hide();
    }
    var editFlag=$("#editFlag").val();
    if(MAX_DAYS==MIN_DAYS){
        $("#dayCount").attr("readonly",true);
    }
    if(editFlag!='edit'){
        if(PPP_UNIT=='y'){
            $("#dayCount").val(MAX_DAYS);
        }else if(PPP_UNIT=='m'){
            $("#dayCount").val(MAX_DAYS);
        }else{
            if(MAX_DAYS==366){
                $("#dayCount").val(365);
            }else{
                $("#dayCount").val(MAX_DAYS);
            }
        }
        if(INSTANT=='Y'){
            $(".select1").attr('checked',true);
            $('#effDate').datetimepicker({lang:'ch',validateOnBlur:false,timepicker:true,format:'Y-m-d H:00:00',minDate:'0',onChangeDateTime:changeTermDate,scrollMonth:false,scrollTime:false});
            $("#effDate").unbind('mousewheel');
            $('#effDate').val(getDefaultDate(new Date(),0,1));
        }else{
            $(".select2").attr('checked',true);
            $('#effDate').datetimepicker({lang:'ch',validateOnBlur:false,timepicker:false,format:'Y-m-d H:00:00',minDate:MIN_DELAY_DAY,onChangeDateTime:changeTermDate,scrollMonth:false,scrollTime:false});
            $("#effDate").unbind('mousewheel');
            $('#effDate').val(getDefaultDate(new Date(),0,1+Number(MIN_DELAY_DAY)));
            $(".select1").attr('disabled',true);
        }

        var effDate = $('#effDate').val();
        effDate = effDate+"";
        var strdate = effDate; 
        strdate = strdate.replace(/-/g,"/");
        var EDate = new Date(strdate);

        if(PPP_UNIT=='y'){
            EDate.calTermDateByMonthOrYear(effDate,'Y',MAX_DAYS,INSTANT);
        }else if(PPP_UNIT=='m'){
            EDate.calTermDateByMonthOrYear(effDate,'M',MAX_DAYS,INSTANT);
        }else{
            $("#termDate").val(getDefaultDate(new Date(),$("#dayCount").val(),1));
        }
    }else{
    	if(INSTANT=='N'){
            $(".select1").attr('disabled',true);
        }
        var edate = $("#effDate").val();
        edate = edate+"";
        edate = edate.substring(0,10);
        var tdate = $("#termDate").val();
        tdate = tdate+"";
        tdate = tdate.substring(0,10);

        if(PPP_UNIT=='y'){
            edate = edate.replace(/-/g,"/");
            var dateS = new Date(edate);
            tdate = tdate.replace(/-/g,"/");
            var dateE = new Date(tdate);
            var days = getDateDiff(dateS,dateE);
            $('#dayCount').val(Math.round(days/365));
        }else if(PPP_UNIT=='m'){
            $('#dayCount').val(getMonthDiff(edate,tdate));
        }
        $('#effDate').datetimepicker({lang:'ch',validateOnBlur:false,timepicker:false,format:'Y-m-d H:00:00',minDate:'0',minTime:'0',onChangeDateTime:changeTermDate,scrollMonth:false,scrollTime:false});
    }
    $('#globalDMY').html(DMY_DESC);
}

function compareTo(beginTime,endTime){
    var beginTimes = beginTime.substring(0,10).split('-');  
    var endTimes   =  endTime.substring(0,10).split('-');  
      
    beginTime = beginTimes[1]+'-'+beginTimes[2]+'-'+beginTimes[0]+' '+beginTime.substring(10,19);  
    endTime    = endTimes[1]+'-'+endTimes[2]+'-'+endTimes[0]+' '+endTime.substring(10,19);   
    var a =(Date.parse(endTime)-Date.parse(beginTime))/3600/1000;
    if(a<0){
        return false;
    }else if (a>0){
        return true;
    }else if (a==0){  
        return false;
    }  
 }
//根据起保日期带出终止日期
function changeTermDate(){
    $('#effDate').css('border','1px solid #c3c3c3');
    $('#effDate').poshytip('hide'); 
    var dayCount = $("#dayCount").val();
    var effDate = $("#effDate").val();
    if(effDate.length==19){
        if(validateDate(effDate)==false) return;
        if(dayCount!=''){
            //var realSignFlag = $("input[name='realSignFlag']:checked").val();
            var date = new Date(effDate.replace(/-/g, "/"));
            effDate = effDate+"";
            if(PPP_UNIT=='y'){
                date.calTermDateByMonthOrYear(effDate,'Y',dayCount,'N');
            }else if(PPP_UNIT=='m'){
                date.calTermDateByMonthOrYear(effDate,'M',dayCount,'N');
            }else{
                $("#termDate").val(getDefaultDate(date,dayCount,0));
            }
        }
    }else{
        $('#effDate').css('border','1px solid red');
        $('#effDate').poshytip('update', '起保时间不正确');
        $('#effDate').poshytip('show'); 
    }
}
//获取时间(时间,天数,下一个小时或者下一天)
function getDefaultDate(date,daySum,next){
    if(daySum==365){
        daySum = processDay(date,daySum);
    }
    //var rsf = $("input[name='realSignFlag']:checked").val();
    var year = date.getFullYear();
    var month = (date.getMonth()+1)<10?('0'+(date.getMonth()+1)):(date.getMonth()+1);
    var day = date.getDate()<10?'0'+date.getDate():date.getDate();
    var hours = date.getHours()<10?'0'+date.getHours():date.getHours();
    /* if(rsf=='Y'){
        //即时起保
        date = new Date(year+"/"+month+"/"+day+" "+hours+":00:00");
        if(daySum==0){
            date = new Date(date.getTime()+next*60*60*1000);
        }else{
            date = new Date(date.getTime()+next*60*60*1000+daySum*24*60*60*1000);
        }
    }else{ */
        //非即时起保
        date = new Date(year+"/"+month+"/"+day+" 00:00:00");
        if(daySum==0){
            date = new Date(date.getTime()+next*24*60*60*1000);
        }else{
            date = new Date(date.getTime()+next*24*60*60*1000+(daySum-1)*24*60*60*1000);
        }
    //}
    var year1 = date.getFullYear();
    var month1 = (date.getMonth()+1)<10?('0'+(date.getMonth()+1)):(date.getMonth()+1);
    var day1 = date.getDate()<10?'0'+date.getDate():date.getDate();
    var hours1 = date.getHours()<10?'0'+date.getHours():date.getHours();
    if(daySum==0){
        return year1+"-"+month1+"-"+day1+" "+hours1+":00:00";
    }else{
        /* if(rsf=='Y'){
            return year1+"-"+month1+"-"+day1+" "+hours1+":00:00";
        }else{ */
            return year1+"-"+month1+"-"+day1+" "+"24:00:00";
        /* } */
    }
}
//关闭提示
function changeDate(){
    $("#clientBir1").css('border','1px solid #c3c3c3');
    $("#clientBir1").poshytip('hide'); 
    $("#clientBir2").css('border','1px solid #c3c3c3');
    $("#clientBir2").poshytip('hide'); 
    //$("#clientBir3").css('border','1px solid #c3c3c3');
    //$("#clientBir3").poshytip('hide'); 
}
//对特殊的365天进行处理，如果包含瑞年2月，则返回366天
function processDay(date,daySum){
    if(date.getMonth()==1 && date.getDate()!=29){
        date = new Date(date.getTime()+1*24*60*60*1000);
    }
    var year = date.getFullYear();
    var month =  date.getMonth()+1;
    if(month>2){
        year = parseInt(year)+1;
    }
    if((year%4==0 && year%100!=0)||(year%100==0 && year%400==0)){
        daySum = parseInt(daySum)+1;
    }
    return daySum;
}
//校验投保日期
function validateDate(effDate){
    var beginDate = getDefaultDate(new Date(),0,1);
    var nowDate = new Date(beginDate.replace(/-/g,"/"));
    var newDate = new Date(effDate.replace(/-/g, "/"));
    //var rsf = $("input[name='realSignFlag']:checked").val();
    if(newDate.getTime()<nowDate.getTime()){
        /* if(rsf=='Y'){
            $('#effDate').css('border','1px solid red');
            $('#effDate').poshytip('update', '即时起保时间为当前时间后整点时间');
            $('#effDate').poshytip('show'); 
            return false;
        }else{ */
            $('#effDate').css('border','1px solid red');
            $('#effDate').poshytip('update', '非即时起保时间至少第二天起');
            $('#effDate').poshytip('show'); 
            return false;
        //}
    }
    if(newDate.getTime()-nowDate.getTime()<MIN_DELAY_DAY*24*60*60*1000){
        $('#effDate').css('border','1px solid red');
        $('#effDate').poshytip('update', "最短延保天数不能小于"+MIN_DELAY_DAY+"天");
        $('#effDate').poshytip('show'); 
        return false;
    }
    if(newDate.getTime()-nowDate.getTime()>MAX_DELAY_DAY*24*60*60*1000){
        $('#effDate').css('border','1px solid red');
        $('#effDate').poshytip('update', "最大延保天数不能超过"+MAX_DELAY_DAY+"天");
        $('#effDate').poshytip('show'); 
        return false;
    }
}
function clearBasicInfoNotice(){
    $('#dayCount,#clientName1,#certificateCode,#clientBir1,#sexId2').css('border','1px solid #c3c3c3');
    $('#dayCount,#clientName1,#certificateCode,#clientBir1,#sexId2').poshytip('hide'); 
}
function hiddedView(id){
    $("#"+id).poshytip('hide'); 
}
function clearDepartureTime(){
    if($("#departureTime").val()!=''){
        $("#departureTime").css('border','1px solid #c3c3c3');
        $("#departureTime").poshytip('hide'); 
    }
}
function clearArrivalTime(){
    if($("#arrivalTime").val()!=''){
        $("#arrivalTime").css('border','1px solid #c3c3c3');
        $("#arrivalTime").poshytip('hide'); 
    }
}
function addBen(){
	$("#editFlag").val('');
	idStr=null;
	$('#cardNo').attr("readonly",false).css("background","transparent");
    $('.cardPw').attr("readonly",false).css("background","transparent");
    if($("#cardDefineName").val()==''){
        $.message("error", "请先选择卡名称");
    }else if(infos.length>=10){
    	$.message("error","目前批量投保信息请不要超过十条");
    }else{
        initData();
        //清空所有div值
        cleanEditDiv();
        $("#addAppInfo").OpenDiv();
    }
    
}
function openWorkDiv(str) {
	
    flag=str;
    menuTreeInit();// 职业类别树初始化
    window.setTimeout(function () {
    	// document.getElementById('workDiv').style.display = 'block';
    	$('#workDiv').OpenDiv4('workBigDiv')
    },1000)
}
//职业列表初始化 start 
function menuTreeInit() {
    // ztree 配置
    var setting = {
        view: {
            dblClickExpand: false
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            beforeClick: beforeClick,
            onDblClick: onDblClick
        },
        async: {
            enable: true,
            url:"activatedCard/queryWorkTree",// 查询下级
            autoParam:["id"],
            dataFilter: filter,
            dataType: 'json'
        }
    }
    // 展示职业树
    $.fn.zTree.init($("#ztree"), setting);
}
function beforeClick(treeId, treeNode) {
    var check = (treeNode && !treeNode.isParent);
    if (!check) $.message("error", "只能选择三级职业类型！");
    return check;
}

function onDblClick(e, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj("ztree")
    var node = zTree.getSelectedNodes()
    if (node.length!=0) {
        if(flag=='0'){
            $('#workId').val(node[0].id)
            $('#workName').val(node[0].name)
            $('.workLevel').html(node[0].workLevel)
        }else if(flag=='1'){
            $('#workIdBbr').val(node[0].id)
            $('#workNameBbr').val(node[0].name)
            $('.workLevelBbr').html(node[0].workLevel)
        }
        closeCurrentDIV4('workDiv', 'workBigDiv');
    }else{
        $.message("error", "请选择职业类型！");
    }
}
//选定职业类型，点击确定
function selectWork() {
    var treeObj = $.fn.zTree.getZTreeObj("ztree");
    var node = treeObj.getSelectedNodes();
    if(node.length!=0){
        if(flag=='0'){
            $('#workId').val(node[0].id)
            $('#workName').val(node[0].name)
            $('.workLevel').html(node[0].workLevel)
        }else if(flag=='1'){
            $('#workIdBbr').val(node[0].id)
            $('#workNameBbr').val(node[0].name)
            $('.workLevelBbr').html(node[0].workLevel)
        }
        closeCurrentDIV4('workDiv', 'workBigDiv');
    }else{
        $.message("error", "请选择职业类型！");
    }
}
function filter(treeId, parentNode, childNodes) {
    if (!childNodes) {
        return null;
    };
    var newChildNodes = $.map(childNodes, function (v, i) {
        var item = {
            'id': v.occCode,
            'pid': v.parentCode,
            'name': v.occName,
            'isParent': v.isParent,
            'workLevel':v.occLevelDesc
        }
        return item
    });
    return newChildNodes;
}

//点击跳转暂存单查询页面
function queryTemporary() {
    $.openLoading_jhk();
    $.ajax({
        url : "activatedCard/batch/temporary",
        type : 'POST',
        async : true,
        success : function(result) {
            window.location.href='<%=path%>/activatedCard/batch/temporary'
        }
    });
}
//数据校验
function validateData(){
    var backFlag = true;
//     var realSignFlag = $("input[name='realSignFlag']:checked").val();
//     if(realSignFlag==undefined){
//         $.message("error","请选择是否即时起保");
//         backFlag = false;
//     }
    var cardNo = $("#cardNo").val();
    if(cardNo==''){
        $('#cardNo').css('border','1px solid red');
        $('#cardNo').poshytip('update', '请填写卡号');
        $('#cardNo').poshytip('show'); 
        backFlag = false;
    }
    var cardPw = $(".cardPw").val();
    if(cardPw==''){
        $('.cardPw').css('border','1px solid red');
        $('.cardPw').poshytip('update', '请填写密码');
        $('.cardPw').poshytip('show'); 
        backFlag = false;
    }
    var dayCount = $("#dayCount").val();
    if(dayCount==''){
        $('#dayCount').css('border','1px solid red');
        $('#dayCount').poshytip('update', '请填写'+DMY_DESC);
        $('#dayCount').poshytip('show'); 
        backFlag = false;
    }
    if(isNaN(dayCount)){
        $('#dayCount').css('border','1px solid red');
        $('#dayCount').poshytip('update', DMY_DESC+'应为整数');
        $('#dayCount').poshytip('show'); 
        backFlag = false; 
    }
    if(dayCount-MIN_DAYS<0){
        $('#dayCount').css('border','1px solid red');
        $('#dayCount').poshytip('update', DMY_DESC+"最小为"+MIN_DAYS);
        $('#dayCount').poshytip('show');
        backFlag = false;
    }
    var MAXDAY1 = MAX_DAYS;
    if(MAX_DAYS==365) MAXDAY1=366;
    if(dayCount-MAXDAY1>0){
        $('#dayCount').css('border','1px solid red');
        $('#dayCount').poshytip('update', DMY_DESC+"最大为"+MAX_DAYS);
        $('#dayCount').poshytip('show');
        backFlag = false;
    }

    var effDate = $("#effDate").val();
    if(effDate==''){
        $('#effDate').css('border','1px solid red');
        $('#effDate').poshytip('update', '请选择起保日期');
        $('#effDate').poshytip('show');
        backFlag = false;
    }
    
    if(validateDate(effDate)==false) return false;
    
    var dateCur = new Date(effDate.replace(/-/g, "/"));
    if(dayCount==366 && !isRunYear(dateCur)){
        $('#dayCount').css('border','1px solid red');
        $('#dayCount').poshytip('update', "平年保险天数最大为365天");
        $('#dayCount').poshytip('show');
        backFlag = false;
    }
    if(riskMainType == '2' && global_SPECIAL_INFO== ''){
        var plateNum = $("#plateNum").val();
        var chassisNum = $("#chassisNum").val();
        if(plateNum == ''&&chassisNum==''){
            $('#plateNum').css('border','1px solid red');
            $('#plateNum').poshytip('update', '车牌号和车架号至少填写一项');
            $('#plateNum').poshytip('show'); 
            backFlag = false; 
        }
        var seatNum = $("#seatNum").val();
        if(seatNum == ''){
            $('#seatNum').css('border','1px solid red');
            $('#seatNum').poshytip('update', '请填写投保座位数');
            $('#seatNum').poshytip('show'); 
            backFlag = false; 
        }
        /*var useNature = $("#useNature").val();
        if(useNature == ''){
            $('#useNature').css('border','1px solid red');
            $('#useNature').poshytip('update', '请选择车辆使用性质');
            $('#useNature').poshytip('show'); 
            backFlag = false; 
        }*/
    }
    if(riskMainType == '7'){
        var departureTime = $("#departureTime").val();
        if(departureTime == ''){
            $('#departureTime').css('border','1px solid red');
            $('#departureTime').poshytip('update', '请选择发车时间');
            $('#departureTime').poshytip('show'); 
            backFlag = false; 
        }
        var arrivalTime = $("#arrivalTime").val();
        if(arrivalTime == ''){
            $('#arrivalTime').css('border','1px solid red');
            $('#arrivalTime').poshytip('update', '请选择到达时间');
            $('#arrivalTime').poshytip('show'); 
            backFlag = false; 
        }
        if(departureTime!=''&&arrivalTime!=''){
            var tdate = $("#termDate").val();
            if(!compareTo(departureTime,arrivalTime)){
                $('#arrivalTime').css('border','1px solid red');
                $('#arrivalTime').poshytip('update', '到达时间要大于发车时间');
                $('#arrivalTime').poshytip('show'); 
                backFlag = false; 
            }else if(tdate!=''&& compareTo(tdate,arrivalTime)){
                $('#arrivalTime').css('border','1px solid red');
                $('#arrivalTime').poshytip('update', '到达时间要小于终保日期');
                $('#arrivalTime').poshytip('show'); 
                backFlag = false; 
            }
        }
        if(effDate!=''&&departureTime!=''){
            if(compareTo(departureTime,effDate)){
                $('#departureTime').css('border','1px solid red');
                $('#departureTime').poshytip('update', '发车时间要大于起保日期');
                $('#departureTime').poshytip('show'); 
                backFlag = false; 
            }
        }
        
        var vehicle = $("#vehicle").val();
        if(vehicle == ''){
            $('#vehicle').css('border','1px solid red');
            $('#vehicle').poshytip('update', '请选择交通工具');
            $('#vehicle').poshytip('show'); 
            backFlag = false; 
        }
        var ticketNo = $("#ticketNo").val();
        if(ticketNo == ''){
            $('#ticketNo').css('border','1px solid red');
            $('#ticketNo').poshytip('update', '请填写客票号码');
            $('#ticketNo').poshytip('show'); 
            backFlag = false; 
        }
        var departureStation = $("#departureStation").val();
        if(departureStation == ''){
            $('#departureStation').css('border','1px solid red');
            $('#departureStation').poshytip('update', '请填写出发地点/起始站');
            $('#departureStation').poshytip('show'); 
            backFlag = false; 
        }
        var arrivalStation = $("#arrivalStation").val();
        if(arrivalStation == ''){
            $('#arrivalStation').css('border','1px solid red');
            $('#arrivalStation').poshytip('update', '请填写到达地点/到达站');
            $('#arrivalStation').poshytip('show'); 
            backFlag = false; 
        }
    }
    if(riskMainType == '9' || riskMainType == '2'){
        var mainVehicleNature = $("#mainVehicleNature").val();
        if(mainVehicleNature == ''){
            $('#mainVehicleNature').css('border','1px solid red');
            $('#mainVehicleNature').poshytip('update', '请填写车辆性质');
            $('#mainVehicleNature').poshytip('show'); 
            backFlag = false; 
        }
    }
    var clientName1 = $("#clientName1").val();
    if(clientName1==''){
        $('#clientName1').css('border','1px solid red');
        $('#clientName1').poshytip('update', '请填写投保人姓名');
        $('#clientName1').poshytip('show'); 
        backFlag = false;
    }
    var certificateType = $("#certificateType").val();
    if(certificateType==''){
        $('#certificateType').css('border','1px solid red');
        $('#certificateType').poshytip('update', '请选择投保人证件类型');
        $('#certificateType').poshytip('show'); 
        backFlag = false;
    }
    var certificateCode = $("#certificateCode").val();
    if(certificateCode==''){
        $('#certificateCode').css('border','1px solid red');
        $('#certificateCode').poshytip('update', '请填写投保人证件号码');
        $('#certificateCode').poshytip('show'); 
        backFlag = false;
    }else if(certificateType=='01'){
        var isSex = $("input[name='sex1']:checked").val();
        var cBir = $("#clientBir1").val();
        if(!validateIdCode(certificateCode,cBir,isSex,'投保人',1)){
            backFlag = false;
        } 
    }

    var cBir = $("#clientBir1").val();
    /* if(cBir=='' && riskMainType !='2' && riskMainType !='9'){
        $('#clientBir1').css('border','1px solid red');
        $('#clientBir1').poshytip('update', '请选择投保人出生日期');
        $('#clientBir1').poshytip('show'); 
        backFlag = false;
    } */
    var isSex = $("input[name='sex1']:checked").val();
    /* if(isSex==undefined && riskMainType !='2' && riskMainType !='9'){
        $("#sexId2").poshytip('update', '请选择投保人性别');
        $("#sexId2").poshytip('show'); 
        backFlag = false;
    } */
    var linkmanTel1 = $("#linkmanTel1").val();
    if(linkmanTel1==''){
        $('#linkmanTel1').css('border','1px solid red');
        $('#linkmanTel1').poshytip('update', '请选择投保人手机号码');
        $('#linkmanTel1').poshytip('show'); 
        backFlag = false;
    }
    var email1 = $(".email1").val();
    if(email1!=''){
    	var emailReg = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/g;
        if(!emailReg.test(email1)){
            $('.email1').css('border','1px solid red');
            $('.email1').poshytip('update', '电子邮箱格式错误');
            $('.email1').poshytip('show'); 
            backFlag = false;
        }
    }
    if(riskMainType != '2'){
       var relWithInsured1 = $("#relWithInsured1").val();
       if(relWithInsured1==''){
           $('#relWithInsured1').css('border','1px solid red');
           $('#relWithInsured1').poshytip('update', '请选择投保人与被保人关系');
           $('#relWithInsured1').poshytip('show'); 
           backFlag = false;
       }
       if(relWithInsured1!='01'){
           var clientName2 = $("#clientName2").val();
           if(clientName2==''){
               $('#clientName2').css('border','1px solid red');
               $('#clientName2').poshytip('update', '请填写被保人姓名');
               $('#clientName2').poshytip('show'); 
               backFlag = false;
           }
           var idType = $("#idType").val();
           if(idType==''){
               $('#idType').css('border','1px solid red');
               $('#idType').poshytip('update', '请选择被保人证件类型');
               $('#idType').poshytip('show'); 
               backFlag = false;
           }
           /* var cBir = $("#clientBir2").val();
           if(cBir==''){
               $('#clientBir2').css('border','1px solid red');
               $('#clientBir2').poshytip('update', '请选择被保人出生日期');
               $('#clientBir2').poshytip('show'); 
               backFlag = false;
           }
           var isSex = $("input[name='sex2']:checked").val();
           if(isSex==undefined){
               $("#sexId4").poshytip('update', '请选择被保人性别');
               $("#sexId4").poshytip('show'); 
               backFlag = false;
           } */
           var idNo = $("#idNo").val();
           if(idNo==''){
               $('#idNo').css('border','1px solid red');
               $('#idNo').poshytip('update', '请填写被保人证件号码');
               $('#idNo').poshytip('show'); 
               backFlag = false;
           }else if(idType=='01'){
               if(!validateIdCode(idNo,cBir,isSex,'被保人',2)) backFlag = false;
           }
       }
    }
    return backFlag;
}
//校验出生日期
function validateIdCode(idNo,cBir,isSex,cBirName,viewFalg){
    var backFalg = true;
    var id="";
    if(viewFalg==1){
        id="certificateCode";
    }else if(viewFalg==2){
        id="idNo";
    }
    if(identityCodeValid(idNo,id)){
        var cB='';
        var sexFalg;
        if(idNo.length==15){
            cB = "19"+idNo.substr(6,2)+"-"+idNo.substr(8,2)+"-"+idNo.substr(10,2);
            if (parseInt(idNo.substr(13, 1)) % 2 == 1) {
                sexFalg = '1';
            } else {
                sexFalg = '2';
            } 
        }
        if(idNo.length==18){
            cB = idNo.substr(6,4)+"-"+idNo.substr(10,2)+"-"+idNo.substr(12,2);
            if (parseInt(idNo.substr(16, 1)) % 2 == 1) {
                sexFalg = '1';
            } else {
                sexFalg = '2';
            } 
        }
        if(cB!=cBir){
            backFalg = false;
            if(viewFalg==1){
                $('#clientBir1').css('border','1px solid red');
                $('#clientBir1').poshytip('update', cBirName+"出生日期与身份证不对应");
                $('#clientBir1').poshytip('show'); 
            }
            if(viewFalg==2){
                $('#clientBir2').css('border','1px solid red');
                $('#clientBir2').poshytip('update', cBirName+"出生日期与身份证不对应");
                $('#clientBir2').poshytip('show'); 
            }
        }
        if(sexFalg != isSex){
            backFalg = false;
            if(viewFalg==1){
                $('#sexId2').poshytip('update', cBirName+"性别与身份证不对应");
                $('#sexId2').poshytip('show'); 
            }
            if(viewFalg==2){
                $('#sexId4').poshytip('update', cBirName+"性别与身份证不对应");
                $('#sexId4').poshytip('show'); 
            }
        }
    }else{
        backFalg = false;
    }
    return backFalg;
}
//是否闰年
function isRunYear(date){
    if(date.getMonth()==1 && date.getDate()!=29){
        date = new Date(date.getTime()+1*24*60*60*1000);
    }
    var year = date.getFullYear();
    var month =  date.getMonth()+1;
    if(month>2){
        year = parseInt(year)+1;
    }
    if((year%4==0 && year%100!=0)||(year%100==0 && year%400==0)){
        return true;
    }else{
        return false;
    }
}
function getAppInfo(){
    var info= new Object();
    info.insuPlanNo=$("#planNo").val();
    info.insuPlanNoDscp=$("#planName").val();
    //info.realSignFlag=$("input:radio[name='realSignFlag']:checked").val();
    info.realSignFlag='N';//非即时起保
    info.dayCount=$("#dayCount").val();
    info.unirPp="1";
    info.trip=$("#trip").val();
    info.effDate=$("#effDate").val();
    info.termDate=$("#termDate").val();
    info.totPremamt=$("#totPremamt").val();
    info.relWithInsured=$("#relWithInsured1").val();
    info.mainVehicleNature=$("#mainVehicleNature").val();
    info.isLagal=$("#isLagal").val();
    info.partnerNo=$("#partnerNo").val();
    //驾乘险信息
    if(riskMainType=='2'){
        info.plateNum=$("#plateNum").val();
        info.chassisNum=$("#chassisNum").val();
        info.seatNum=$("#seatNum").val();
        // info.useNature=$("#useNature").val();
    }
      //乘意险信息
    if(riskMainType=='7'){
        info.trainNumber=$("#trainNumber").val();
        info.seatNumber=$("#seatNumber").val();
        info.departureTime=$("#departureTime").val();
        info.arrivalTime=$("#arrivalTime").val();
        info.ticketNumber=$("#ticketNumber").val();
        info.vehicle=$("#vehicle").val();
        info.ticketNo=$("#ticketNo").val();
        info.departureStation=$("#departureStation").val();
        info.arrivalStation=$("#arrivalStation").val();
    }
    //投保人信息
    info.clientNameTbr=$("#clientName1").val();
    info.clientBirTbr=$("#clientBir1").val();
    info.certificateTypeTbr=$("#certificateType").val();
    info.certificateCodeTbr=$("#certificateCode").val();
    info.sexTbr=$("input[name='sex1']:checked").val();
    info.linkmanTelTbr=$("#linkmanTel1").val();
    info.emailTbr=$(".email1").val();
    info.tbrNature=$("#appNature").val();
    info.appNationalityTbr=$("#appNationality").val();
    info.workTypeTbr=$("#workId").val();
    info.workTypeNameTbr=$("#workName").val(); 
    //被保人信息
    var relWithInsured1=$("#relWithInsured1").val();
    if(riskMainType!='2' || global_SPECIAL_INFO=='0'){
        if(relWithInsured1=="01"){//如果同投保人
               info.clientNameBbr=$("#clientName1").val();
               info.idTypeBbr=$("#certificateType").val();
               info.idNoBbr=$("#certificateCode").val();
               info.clientBirBbr=$("#clientBir1").val(); 
               info.sexBbr=$("input[name='sex1']:checked").val();
               info.clientTelBbr=$("#linkmanTel1").val();
               info.insNationalityBbr=$("#appNationality").val();
               info.workTypeBbr=$("#workId").val(); 
               info.workTypeNameBbr=$("#workName").val(); 
        }else{//不是本人则取被保人填报的信息
	        info.clientNameBbr=$("#clientName2").val();
	        info.idTypeBbr=$("#idType").val();
	        info.idNoBbr=$("#idNo").val();
	        info.clientBirBbr=$("#clientBir2").val(); 
	        info.sexBbr=$("input[name='sex2']:checked").val();
	        info.clientTelBbr=$("#clientTel2").val();
	        info.insNationalityBbr=$("#insNationality").val();
            info.workTypeBbr=$("#workIdBbr").val();
            info.workTypeNameBbr=$("#workNameBbr").val(); 
        }
    }
return info;
}
//新增被保人
function saveInfo(){

    //投保信息校验
    if(false==validateData()) return ;
	// 基本信息
    var cardNo = $('#cardNo').val();
    var cardPw = $('.cardPw').val();
    var cardDefineId = $('#cardDefineId').val();
    var relWithInsured=$("#relWithInsured1").val();
    if(relWithInsured=="01"){//如果同投保人
	    var clientNameBbr=$("#clientName1").val();
	    var idTypeBbr=$("#certificateType").val();
	    var idNoBbr=$("#certificateCode").val();
	}else{//不是本人则取被保人填报的信息
		var clientNameBbr=$("#clientName2").val();
		var idTypeBbr=$("#idType").val();
		var idNoBbr=$("#idNo").val();
	}
    //添加之前，遍历数组 投保信息是否做重复投保判断？？？？
    if(infos.length>0){
        for(var i=0;i<infos.length;i++){
            //添加之前，遍历数组，判断是否存在重复卡号
            if(cardNo==infos[i].cardNo){
                if(idStr!=null&&idStr==i){
                    continue;
                } else {
                    $.message("error","卡号:"+cardNo+"已存在");
                return;
                }
            }
            /* //添加之前，遍历数组，判断是否存在重复被保险人（重复条件：姓名+证件类型+证件号码 相同）
            if(clientNameBbr==infos[i].clientNameBbr&&idTypeBbr==infos[i].idTypeBbr&&idNoBbr==infos[i].idNoBbr){
                if(idStr!=null&&idStr==i){
                    continue;
                }else{
                    $.message("error","该被保险人"+clientNameBbr+"已存在");
                    return;
                }
            } */
        }
    } 

    var editflag=$("#editFlag").val();
    //卡号密码验证
    $.openLoading_jhk();
    $.ajax({
        url : "activatedCard/checkCard",
        type : 'POST',
        async : true,
        dataType:'json',
        data:{cardNo:cardNo,cardPw:cardPw,cardDefineId:cardDefineId,editflag:editflag},
        success : function(result){
            $.closeLoading();
            if("fail"==result.result){
                $.message("error", "系统错误,请联系管理员");
            }else if("success"==result.result){
                //投保信息保存到对象
                var info = getAppInfo();
                info.cardNo=cardNo;
                info.cardPw=cardPw;
                var messageStr;
                if(idStr!=null){
                    infos.splice(idStr,1,info);
                    messageStr="修改投保信息成功";
                }else{
                    infos.splice(infos.length,1,info);
                    messageStr="新增投保信息成功";
                }
                idStr=null;
                closeEditInfoDiv();
                loadInsuredInfo(infos);
                $.message("success",messageStr);
            }else{
                $.message("error", result.message);
            }
        }
    });
}
//关闭 清空弹窗信息
function closeEditInfoDiv(){
	//清空所有div值
    cleanEditDiv();
    //关闭
    $("#addAppInfo").CloseDiv();
}
function cleanEditDiv(){
	$('#cardNo').val('');
    $('.cardPw').val('');
    //投保基本信息
    $("#mainVehicleNature").val('');
    $("#plateNum").val('');
    $("#chassisNum").val('');
    $("#seatNum").val('');
    // $("#useNature").val('');
    $("#trainNumber").val('');
    $("#seatNumber").val('');
    $("#departureTime").val('');
    $("#arrivalTime").val('');
    $("#ticketNumber").val('');
    $("#vehicle").val('');
    $("#ticketNo").val('');
    $("#departureStation").val('');
    $("#arrivalStation").val('');
    //投保人信息
    $("#clientName1").val('');
    $("#clientBir1").val('');
    $("#certificateType").val('');
    $("#certificateCode").val('');
    $("input[name='sex1']:checked").removeAttr("checked");
    $("#linkmanTel1").val('');
    $(".email1").val('');
    $("#appNationality").val('');
    $("#relWithInsured1").val('');
    $(".appInsuredClass").hide();
    $("#workId").val('');
    $("#workName").val('');
    $(".workLevel").html('');
    //被保人信息
    $("#clientName2").val('');
    $("#idType").val('');
    $("#idNo").val('');
    $("#clientBir2").val(''); 
    $("input[name='sex2']:checked").removeAttr("checked");
    $("#clientTel2").val('');
    $("#insNationality").val('');
    $("#workIdBbr").val('');
    $("#workNameBbr").val('');
    $(".workLevelBbr").html('');
}
//加载页面列表信息
function loadInsuredInfo(infos){
        var trHtml;
        $("#infoTbody").empty();
        for(var i = 0; i < infos.length; i++){
            trHtml="<tr><td style='text-align:center'>"+infos[i].cardNo+"</td>" //卡号
               +"<td style='text-align:center'>"+infos[i].clientNameTbr+"</td>"//投保人姓名
               +"<td style='text-align:center'>"+infos[i].certificateCodeTbr+"</td>"//投保人证件
               +"<td style='text-align:center'>"+infos[i].effDate+"</td>"//起保时间
               +"<td style='text-align:center'>"+infos[i].termDate+"</td>";//终保时间
               if(infos[i].clientNameBbr==null){
            	   trHtml=trHtml+"<td style='text-align:center'>&nbsp;</td>";//被保人姓名
               }else{
            	   trHtml=trHtml+"<td style='text-align:center'>"+infos[i].clientNameBbr+"</td>";//被保人姓名
               }
               if(infos[i].idNoBbr==null){
                   trHtml=trHtml+"<td style='text-align:center'>&nbsp;</td>";//被保人证件号
               }else{
                   trHtml=trHtml+"<td style='text-align:center'>"+infos[i].idNoBbr+"</td>";//被保人证件号
               }
               if(infos[i].clientBirBbr==null){
                   trHtml=trHtml+"<td style='text-align:center'>&nbsp;</td>";//被保人出生日期
               }else{
                   trHtml=trHtml+"<td style='text-align:center'>"+infos[i].clientBirBbr+"</td>";//被保人出生日期
               }
               trHtml=trHtml+"<td style='text-align:center'><a href='javascript:void(0)' onclick=editInfo("+i+")>[编辑]</a><a href='javascript:void(0)' onclick=warnBeforeDel("+i+")>[删除]</a></td></tr>"
            $("#infoTbody").append(trHtml);
        }
    }
// 编辑一条记录
function editInfo(i){
    $("#editFlag").val('edit');
    initData();
    idStr=i;
    var id=i;
    $('#cardNo').val(infos[id].cardNo);
    $('.cardPw').val(infos[id].cardPw);
    if ($("#stagNo").val().length>0) {
        $('#cardNo').attr("readonly",true).css("background","#CCC");
        $('.cardPw').attr("readonly",true).css("background","#CCC");
    }else{
        $('#cardNo').attr("readonly",false).css("background","transparent");
        $('.cardPw').attr("readonly",false).css("background","transparent");
    }
    //投保信息
    $("#effDate").val(infos[id].effDate);
    $("#termDate").val(infos[id].termDate);
    var edate1 = $("#effDate").val();
    edate1 = edate1+"";
    edate1 = edate1.substring(0,10);
    var tdate1 = $("#termDate").val();
    tdate1 = tdate1+"";
    tdate1 = tdate1.substring(0,10);

    if(PPP_UNIT=='y'){
        edate1 = edate1.replace(/-/g,"/");
        var dateS1 = new Date(edate1);
        tdate1 = tdate1.replace(/-/g,"/");
        var dateE1 = new Date(tdate1);
        var days1 = getDateDiff(dateS1,dateE1);
        $('#dayCount').val(Math.round(days1/365));
        DMY_DESC = '保险年数：';
    }else if(PPP_UNIT=='m'){
        $('#dayCount').val(getMonthDiff(edate1,tdate1));
        DMY_DESC = '保险月数：';
    }else{
        $("#dayCount").val(infos[id].dayCount);
        DMY_DESC = '保险天数：';
    }
    $('#globalDMY').html(DMY_DESC);
    $("#relWithInsured1").val(infos[id].relWithInsured);
    if(infos[id].relWithInsured=='01'){
        $(".appInsuredClass").hide();
    }else{
    	$(".appInsuredClass").show();
    }
    $("#mainVehicleNature").val(infos[id].mainVehicleNature);
    //驾乘险信息
    if(riskMainType=='2'){
        $("#plateNum").val(infos[id].plateNum);
        $("#chassisNum").val(infos[id].chassisNum);
        $("#seatNum").val(infos[id].seatNum);
        // $("#useNature").val(infos[id].useNature);
    }
      //乘意险信息
    if(riskMainType=='7'){
        $("#trainNumber").val(infos[id].trainNumber);
        $("#seatNumber").val(infos[id].seatNumber);
        $("#departureTime").val(infos[id].departureTime);
        $("#arrivalTime").val(infos[id].arrivalTime);
        $("#ticketNumber").val(infos[id].ticketNumber);
        $("#vehicle").val(infos[id].vehicle);
        $("#ticketNo").val(infos[id].ticketNo);
        $("#departureStation").val(infos[id].departureStation);
        $("#arrivalStation").val(infos[id].arrivalStation);
    }
	//投保人信息
    $("#clientName1").val(infos[id].clientNameTbr);
    $("#clientBir1").val(infos[id].clientBirTbr);
    $("#appNature").val(infos[id].tbrNature);
    changeTbrIdType();
    $("#certificateType").val(infos[id].certificateTypeTbr);
    $("#certificateCode").val(infos[id].certificateCodeTbr);
    $("input[name='sex1']").attr('checked', false);
    $.each($("input[name='sex1']"), function(i, v) {
        if (v.value === infos[id].sexTbr) {
            $(v).attr('checked', true)
        }
    });
    $("#linkmanTel1").val(infos[id].linkmanTelTbr);
    $(".email1").val(infos[id].emailTbr);
    $("#appNationality").val(infos[id].appNationalityTbr);
	$("#workId").val(infos[id].workTypeTbr);
    $("#workName").val(infos[id].workTypeNameTbr);
    //被保人信息
    $("#clientName2").val(infos[id].clientNameBbr);
    $("#idType").val(infos[id].idTypeBbr);
    $("#idNo").val(infos[id].idNoBbr);
    $("#clientBir2").val(infos[id].clientBirBbr); 
    $("input[name='sex2']").attr('checked', false);
    $.each($("input[name='sex2']"), function(i, v) {
        if (v.value === infos[id].sexBbr) {
            $(v).attr('checked', true)
        }
    });
    $("#clientTel2").val(infos[id].clientTelBbr);
    $("#insNationality").val(infos[id].insNationalityBbr);
    $("#workIdBbr").val(infos[id].workTypeBbr);
    $("#workNameBbr").val(infos[id].workTypeNameBbr);
    $('#addAppInfo').OpenDiv();
}
// 删除提示
function warnBeforeDel(id){
    $.dialog({
    	type: "warn",
        content: "确定要删除该投保信息吗？",
        onOk: function() {
            deleteInfo(id);
        }
    });
}
//删除投保信息
function deleteInfo(id){
    $.openLoading_jhk();
    var stagNo = $("#stagNo").val();
    if(stagNo.length>0){
    	$.ajax({
            url : "activatedCard/batch/deleteAppInfo",
            type : 'POST',
            async : true,
            dataType:'json',
            data:{cardNo:infos[id].cardNo,
                  stagNo:stagNo
                },
            success : function(result){
                $.closeLoading();
                if("fail"==result.result){
                    $.message("error", "系统错误,请联系管理员");
                    return true;
                }
                if("success"==result.result){
                    infos.splice(id, 1);
                    loadInsuredInfo(infos);
                    $.message("success","投保信息删除成功");
                }else{
                    $.message("error", result.message);
                }
            }
        }); 
    }else{
        infos.splice(id, 1);
        loadInsuredInfo(infos);
        $.closeLoading();
        $.message("success","投保信息删除成功");
    }
}
//保存提交
function saveInfos() {
    //console.log(JSON.stringify(infos));
    if(infos==null||infos.length==0){
    	$.message("error","没有投保信息，不可提交");
    }else if(infos.length>10){
        $.message("error","目前批量投保信息请不要超过十条");
    }else{
	    var stagNo=$("#stagNo").val();
	    $.openLoading_jhk();
	    $.ajax({
	        url : "activatedCard/batch/saveTemporary",
	        type : 'POST',
	        async : true,
	        dataType:'json',
	        data:{//"baseInfo":JSON.stringify(baseInfo),
	              "infos":JSON.stringify(infos),
	              stagNo:stagNo
	            },
	        success : function(result){
	            $.closeLoading();
	            if("fail"==result.result){
	                $.message("error", "系统错误,请联系管理员");
	                return true;
	            }
	            if("success"==result.result){
	                $("#stagNo").val(result.data);
                    $.message("success",result.message)
	            }else{
	            	if(result.data!=null){
	            		$("#stagNo").val(result.data);
	            	}
	                $.message("error", result.message);
	            }
	        }
	    }); 
    }
}
//下一步
function previewSubmit() {
    //console.log(JSON.stringify(infos));
	if(infos==null||infos.length==0){
        $.message("error","没有投保信息，不可提交");
    }else if(infos.length>10){
        $.message("error","目前批量投保信息请不要超过十条");
    }else{
	    var stagNo=$("#stagNo").val();
	    $.openLoading_jhk();
	    $.ajax({
	        url : "activatedCard/batch/saveTemporary",
	        type : 'POST',
	        async : true,
	        dataType:'json',
	        data:{//"baseInfo":JSON.stringify(baseInfo),
	              "infos":JSON.stringify(infos),
	              stagNo:stagNo
	            },
	        success : function(result){
	            if("fail"==result.result){
	                $.closeLoading();
	                $.message("error", "系统错误,请联系管理员");
	                return true;
	            }
	            if("success"==result.result){
	                //$.message("success",result.message)
	                $("#stagNo").val(result.data);
	                window.location.href='<%=path%>/activatedCard/batch/previewBatch?stagNo='+result.data;
	            }else{
	                $.closeLoading();
	                if(result.data!=null){
	                    $("#stagNo").val(result.data);
	                }
	                $.message("error", result.message);
	            }
	        }
	    });
    }
}
function openQueryDiv() {
	$("#openCard").OpenDiv();
}
//打开卡号密码登录div
function openLoginDiv(flag){
    $("#flag").val(flag);
    $("#editLoginDiv").OpenDiv();
}
//验证用户名和密码
function checkCardNo(){
    var cardNo=$("#cardNo1").val();
    var password=$("#password1").val();
    if(cardNo.length==0){
        $.message("error", "请输入卡号");
        return;
    }
    if(password.length==0){
        $.message("error", "请输入密码");
        return;
    }
    $.openLoading_jhk();
    $.ajax({
        url : "activatedCard/batch/checkCard",
        type : 'POST',
        async : true,
        dataType:'json',
        data:{cardNo:cardNo,cardPw:password},
        success : function(result) {
            if("success"==result.result&&""!=result.message){
            	$("#stagNo").val(result.data);
            	$.message("success", "卡号密码验证成功，正在加载暂存单信息");
            	window.location.href='<%=path%>/activatedCard/batch/add?stagNo='+result.data;
            }
            if("fail"==result.result){
                $.closeLoading();
                $.message("error", "系统错误,请联系管理员");
            }
            if("error"==result.result&&""!=result.message){
                $.closeLoading();
                $.message("error", result.message);
            }
        }
    });
}
function tempReset(){
    $("#search_name").val("");
    $("#search_id").val("");
}


function getAppInfoByExcel(data){
    var info= new Object();
    info.insuPlanNo=$("#planNo").val();
    info.insuPlanNoDscp=$("#planName").val();
    info.realSignFlag='N';//非即时起保
    info.unirPp="1";
    info.totPremamt=$("#totPremamt").val();
    info.partnerNo=$("#partnerNo").val();
    info.effDate=data.effDate;
    info.termDate=data.termDate;
    info.relWithInsured=data.relWithInsured;
    info.mainVehicleNature=data.mainVehicleNature;
    info.cardNo=data.cardNo;
    info.cardPw=data.cardPw;
    //驾乘险信息
    if(riskMainType=='2'){
	    info.relWithInsured="01";
        info.plateNum=data.plateNum;
        info.chassisNum=data.chassisNum;
        info.seatNum=data.seatNum;
        // info.useNature=data.useNature;
    }
    //投保人信息
    info.clientNameTbr=data.tbrName;
    info.clientBirTbr=data.tbrBir;
    info.certificateTypeTbr=data.tbrIdType;
    info.certificateCodeTbr=data.tbrIdNo;
    info.sexTbr=data.tbrSex;
    info.linkmanTelTbr=data.tbrTel;
    info.emailTbr=data.tbrEmail;
    info.tbrNature=data.tbrNature;
    info.appNationalityTbr=data.tbrNationality;
    info.workTypeTbr=data.tbrWorkType;
    info.workTypeNameTbr=data.tbrWorkName;
    //被保人信息
    if(riskMainType!='2'){
    	info.clientNameBbr=data.bbrName;
        info.idTypeBbr=data.bbrIdType;
        info.idNoBbr=data.bbrIdNo;
        info.clientBirBbr=data.bbrBir;
        info.sexBbr=data.bbrSex;
        info.clientTelBbr=data.bbrTel;
        info.insNationalityBbr=data.bbrNationality;
        info.workTypeBbr=data.bbrWorkType;
        info.workTypeNameBbr=data.bbrWorkName;
    }
	return info;
}

//上传excel事件
function xlsImportFileUpload(){
	var cardDefineName = $('#cardDefineName').val();
	var cardDefineId = $('#cardDefineId').val();
	if (cardDefineName=='') {
		$.message("error","请先选择卡名称");
		return;
	}
	$.openLoading();
	var fileNameStr = $('#fileToUpload').val();
	fileNameStr = fileNameStr+"";
	var lastDotIndex = fileNameStr.lastIndexOf(".");
	if(lastDotIndex==-1){
		$.closeLoading();
		$.message("error","请选择扩展名为 .xls 的文件上传");
		return;
	}else{
		var extName = fileNameStr.substring(lastDotIndex+1, fileNameStr.length);
		if(extName.toLowerCase() != "xls"){
			$.closeLoading();
			$.message("error","请选择扩展名为 .xls 的文件上传");
			return;
		}
	}
	$.ajaxFileUpload({
        url:'<%=path%>/activatedCard/xlsImportFileUpload',
        fileElementId :'fileToUpload',//file控件id
        dataType: 'json',
        secureuri : false,
        type: "POST",
        data:{
            "riskMainType" : riskMainType,
            "cardDefineId" : cardDefineId
		},
        success : function (data){
        	$.closeLoading();
        	if(data.result==false){
        		$.dialog({
	    			width: 358,
	    			top:40,
	    			modal:true,
	    			Close:true,
	    			cancel:null,
	    			content: data.errorMsg
	    		});
	        	return;
        	}else{
        		var dataList = data.dataList;
        		for (var i = 0; i < dataList.length; i++) {
	        		var info = getAppInfoByExcel(dataList[i]);
	        		infos.splice(infos.length,1,info);
	        		loadInsuredInfo(infos);
				}
        	}
		}
	});
};



</script>
</head>
<body>
    <div class="current">
        <table class="current_table_1">
            <tbody>
                <tr class="f2">
                    <td><img src="./images/current_1.jpg"></td>
                    <td class="current_table_1_td"><img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                        <span style="color: #136bab;">激活卡管理 <span
                            style="padding: 0 5px; font-weight: bold; line-height: 28px;">&gt;</span>激活卡激活
                            <span
                            style="padding: 0 5px; font-weight: bold; line-height: 28px;">&gt;</span>批量激活
                    </span></td>
                    <td><img src="./images/current_3.jpg"></td>
                </tr>
            </tbody>
        </table>
    </div>
    <div style="float:right"><a href="javascript:;" onclick="openQueryDiv()">暂存单查询</a></div>
   <div class="setp"><jsp:include page="../include/stepScroll.jsp"/></div>
        <input type="hidden" name="stagNo" id="stagNo" value="${stagNo}"/>
        <input type="hidden" name="planNo" id="planNo" value="${prodInfo.planNo}"/>
        <input type="hidden" name="appNo" id="appNo" value="${appNo}" />
        <input type="hidden" name="partnerNo" id="partnerNo" value="${prodInfo.partnerNo}"/>
        <input type="hidden" name="editFlag" id="editFlag" />
        <input type="hidden" name="MAX_DAYS" id="MAX_DAYS" value="${prodInfo.maxDays}"/>
        <input type="hidden" name="MIN_DAYS" id="MIN_DAYS" value="${prodInfo.minDays}"/>
        <input type="hidden" name="UNIR_PP" id="UNIR_PP" value="${prodInfo.unirPp}"/>
        <input type="hidden" name="MAX_DELAY_DAY" id="MAX_DELAY_DAY" value="${prodInfo.maxDelayDay}"/>
        <input type="hidden" name="MIN_DELAY_DAY" id="MIN_DELAY_DAY" value ="${prodInfo.minDelayDay}"/>
        <input type="hidden" name="INSTANT" id="INSTANT" value="${prodInfo.instant}"/>
        <input type="hidden" name="PPP_UNIT" id="PPP_UNIT" value="${prodInfo.pppUnit}"/>
        <input type="hidden" name="global_SPECIAL_INFO" id="global_SPECIAL_INFO" value="${prodInfo.specialInfo}"/>
        <input type="hidden" name="riskMainType" id="riskMainType" value="${prodInfo.riskMainType}"/>
        <input type="hidden" name="pricelessType" id="pricelessType" value="${prodInfo.pricelessType}"/>
        <input type="hidden" name="relWithInsuredFlag" id="relWithInsuredFlag" value ="${facadeAppApplicant.relWithInsured}"/>
      <div>
        <table class="table_05" >
            <tbody>
                <tr>
                    <td colspan="4"
                        style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">卡单信息</td>
                </tr>
                <tr>
                    <th width="20%">卡名称：</th>
                    <td width="23%"><input id="cardDefineName"
                        name="cardDefineName" type="text" readonly
                        style="background-color: #ccc;" class="input_text"><span
                        class="red">*</span><input
                        type="button" class="input_button_2" id="searchBtn" value="选择卡定义"
                        onClick="openTempDiv(1,this)" />
                    <input type="hidden" name="cardDefineId" id="cardDefineId" />
                    </td>
                    <th width="22%">保费(元)：</th>
                    <td width="25%"><input id="totPremamt" type="text"
                        readonly="readonly" style="background-color: #ccc;" class="input_text" />
                    </td>
                </tr>
                <tr>
                    <th>投保方案：</th>
                    <td colspan='3'><input name="planName" id="planName" type="text"
                        readonly="readonly" style="background-color: #ccc;" class="input_text" />
                    </td>
                </tr>
            </tbody>
        </table>
      </div>
       <div id="bbrDiv">
           <table class="table_05">
               <tr>
                   <td colspan="2"
                     style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">投保信息列表
                     <input type="button" id="insureBtn" value="录入投保信息" class="appendBen" onclick="addBen()"/>
                     <input style="width: 180px"  id="fileToUpload" name="myfiles" type='file'/><a href="javascript:void(0);" id="buttonUpload" onclick="xlsImportFileUpload()">批量导入投保信息</a>
                     <a style="margin-left: 50px"  href="<%=path%>/activatedCard/downloadActivated" >批量导入投保信息模板下载</a>
                   </td>
               </tr>
               <tr>
                   <td colspan='9'>
                       <table class="appendBen addAppendBen table_05" style="width: 90%;">
                           <thead>
                               <tr style="font-size: 12px; font-weight: bold; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">
			                       <th style="text-align: center;width:11%">卡号</th>
			                       <th style="text-align: center;width:8%">投保人姓名</th>
			                       <th style="text-align: center;width:12%">投保人证件号</th>
			                       <th style="text-align: center;width:13%">起保时间</th>
			                       <th style="text-align: center;width:13%">终保时间</th>
			                       <th style="text-align: center;width:9%">被保人姓名</th>
			                       <th style="text-align: center;width:12%">被保人证件号</th>
			                       <th style="text-align: center;width:12%">被保人出生日期</th>
			                       <th style="text-align: center;width:10%">操作</th>
                               </tr>
                           </thead>
                           <tbody id="infoTbody">
                               <tr></tr>
                           </tbody>
                       </table>
                   </td>
               </tr>
           </table>
        </div>
        <br>
        <div style="text-align:center;margin-bottom:20px">
           <input class="input_button_2" id="saveBtn" type="button" onclick="saveInfos()" value="保  存">
           <input class="input_button_2" id="nextBtn" type="button" onclick="previewSubmit()" value="下一步">
        </div>
    <!--    添加模板 DIV 默认隐藏-->
    <div id="addtempletDiv" style="display: none; width: 80%">
        <input type="hidden" id="row_num" name="row_num" value="0" />
        <div class="table_title_div">
            <table class="table_title" style='width: 100%;'>
                <tr>
                    <td width="10%"></td>
                    <td width="80%" id="interfaceName"></td>
                    <td width="10%" align="right"><img
                        src="<%=path%>/images/closedown.gif" alt="关闭"
                        onclick="closeCurrentDIV('addtempletDiv')" /></td>
                </tr>

            </table>
        </div>
        <form id="inputForm" action="save.jhtml" method="post"
            enctype="multipart/form-data">

            <table class="table_02" id="addTempleteTable" style="height: 180px;"
                align="center">
                <tbody>
                    <tr>
                        <td>
                            <table class="search_table">
                                <tbody>
                                    <tr height="30px">
                                        <td width="40%" height="30">卡定义名称： <input name="txt3"
                                            id="search_name" type="text" class="input_text" value="">
                                        </td>
                                        <td width="40%" height="30">卡定义号： <input name="txt3"
                                            id="search_id" type="text" class="input_text" value="">
                                        </td>
                                        <td width="20%" height="30"><input type="button"
                                            class="input_button_1" id="searchBtn1" value="查询"
                                            onclick="queryCarTemplate(1)">&nbsp; <input
                                            type="button" class="input_button_1" id="resetBtn"
                                            value="重置" onclick="tempReset()"></td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table id="templetTable" class="content_table_1">
                                <thead>
                                    <tr class="f1">
                                        <th style="width: 5%">选择</th>
                                        <th style="width: 65%">卡定义名称</th>
                                        <th style="width: 20%">卡定义号</th>
                                    </tr>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>
                            <div id="templetpageDIV" class="page"></div>
                        </td>
                    </tr>
                </tbody>
            </table>
            <div align="center">
                <input class="input_button_3" name="" type="button"
                    onclick="chooseTemp()" value="确定">&nbsp;&nbsp; <input
                    class="input_button_3" name="" type="button"
                    onclick="closeCurrentDIV('addtempletDiv')" value="取消">
            </div>
        </form>
    </div>
    <div id="workDiv" style="display: none; width: 500px;position:absolute;left:20%;top:20%;z-index:10010;background:white;">
	        <div class="table_title_div">
	            <table class="table_title" style='width: 100%; height: 20px;'>
	                <tr>
	                    <td width="10%"></td>
	                    <td width="80%" id="interfaceName"></td>
	                    <td width="10%" align="right"><img
	                        src="./images/closedown.gif" alt="关闭"
	                        onclick="closeCurrentDIV4('workDiv', 'workBigDiv')" /></td>
	                </tr>
	            </table>
	        </div>
	        <div class="table_title_body scroll_body">
	            <ul class="ztree" id="ztree">
	            </ul>
	        </div>
	        <div align="center">
	            <input class="input_button_3" type="button" onclick="selectWork()" value="确定">&nbsp;&nbsp; 
	            <input class="input_button_3" type="button" onclick="closeCurrentDIV4('workDiv', 'workBigDiv')" value="取消">
	        </div>
	    </div>
    <div id="addAppInfo" style="display: none; width: 1000px;height:500px;overflow-y:scroll;">
        <div class="table_title_div">
            <table class="table_title" style='width: 100%;'>
                <tr>
                    <td width="10%"></td>
                    <td width="80%" id="interfaceName"></td>
                    <td width="10%" align="right"><img
                        src="<%=path%>/images/closedown.gif" alt="关闭"
                        onclick="closeCurrentDIV('addAppInfo')" /></td>
                </tr>
            </table>
        </div>
        
        <table class="table_05">
            <tbody>
                <tr>
                    <td colspan="4"
                        style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">基本信息
                    </td>
                </tr>
                <tr>
                    <th width="20%">卡号：</th>
                    <td width="23%">
                        <input name="cardNo" id="cardNo" class="input_text notNullClass"/>
                        <span class="red">*</span>
                    </td>
                    <th width="22%">密码：</th>
                    <td width="25%">
                        <input type="password" name="cardPw" class="cardPw input_text notNullClass" autocomplete="off"/>
                        <span class="red">*</span>
                    </td>
                </tr>
                <tr>
                    <th>起保日期：</th>
                    <td>
                        <input name="effDate" id="effDate" readonly="readonly" class="input_text"/>
                        <span class="red">*</span>
                    </td>
                    <th>终保日期：</th>
                    <td>
                        <input name="termDate" id="termDate" readonly="readonly" class="input_text"/>
                    </td>
                </tr>
                <tr>
                    <th id="globalDMY">保险天数：</th>
                    <td colspan='3'>
                        <input name="dayCount" maxlength="7" id="dayCount" class="input_text"/>
                        <span class="red">*</span>
                    </td>
                </tr>
               <%-- <tr style="display:none;" id=vehicleNatureId>
                    <th>车辆性质：</th>
                    <td colspan='3'>
                        <select name="vehicleNature" id="vehicleNature"
                        style="width: 180px; display: inline-block; border: 1px solid #c3c3c3;">
                         <option value="" selected >------请选择-----</option>
                            <c:forEach var="n" items="${vehicleNatureList}">
                                <option value="${n.code}">${n.codeName}</option>
                            </c:forEach>
                       </select>
                    </td>
                </tr>--%>
                <tr style="display:none;" id="mainVehicleNatureId">
                    <th>车辆性质：</th>
                    <td colspan='3'>
                        <select name="mainVehicleNature" id="mainVehicleNature"
                                style="width: 180px; display: inline-block; border: 1px solid #c3c3c3;">
                            <option value="" selected >------请选择-----</option>
                            <c:forEach var="n" items="${mainVehicleNatureList}">
                                <option value="${n.code}">${n.codeName}</option>
                            </c:forEach>
                        </select>
                    </td>
                </tr>
                <tr name="drivingInfo" style="display:none;">
                    <th>车牌号：</th>
                   <td>
                       <input class="input_text notNullClass" name="plateNum" maxlength="50" id="plateNum" />
                   </td>
                    <th>车架号：</th>
                   <td>
                       <input class="input_text notNullClass" name="chassisNum" maxlength="50" id="chassisNum" />
                   </td>
                </tr>
                <tr name="drivingInfo1" style="display:none;">
                    <th>投保座位数：</th>
                   <td>
                       <input class="input_text notNullClass" name="seatNum" maxlength="10" id="seatNum" />
                       <span class="red">*</span>
                   </td>
                    <th>车辆使用性质：</th>
                   <td>
                       <select name="useNature" id="useNature"
                        style="width: 180px; display: inline-block; border: 1px solid #c3c3c3;">
                            <c:forEach var="n" items="${useNatureList}">
                                <option value="${n.code}">${n.codeName}</option>
                            </c:forEach>
                       </select>
                   </td>
                </tr>
                <tr name = "ticketInfo" style="display:none;">
                   <th>车次号：</th>
                   <td>
                       <input class="input_text" name="trainNumber" maxlength="30" id="trainNumber" />
                   </td>
                   <th>座位号：</th>
                   <td>
                       <input class="input_text" name="seatNumber" maxlength="10" id="seatNumber" />
                   </td>
                </tr>
                <tr name = "ticketInfo" style="display:none;">
                   <th>发车时间：</th>
                   <td>
                       <input class="input_text notNullClass" name="departureTime" readonly id="departureTime"/>
                       <span class="red">*</span>
                   </td>
                   <th>到达时间：</th>
                   <td>
                       <input class="input_text notNullClass" name="arrivalTime" readonly id="arrivalTime" />
                       <span class="red">*</span>
                   </td>
                </tr>
                <tr name = "ticketInfo" style="display:none;">
                   <th>车票号：</th>
                   <td>
                       <input class="input_text" name="ticketNumber" maxlength="30" id="ticketNumber" />
                   </td>
                   <th>交通工具：</th>
                   <td>
                       <select class="notNullClass" name="vehicle" id="vehicle"
                        style="width: 180px; display: inline-block; border: 1px solid #c3c3c3;">
                            <option value=''>请选择</option>
                            <c:forEach var="n" items="${vehicleList}">
                                <option value="${n.code}">${n.codeName}</option>
                            </c:forEach>
                       </select>
                       <span class="red">*</span>
                   </td>
                </tr>
                <tr name = "ticketInfo" style="display:none;">
                   <th>客票号码：</th>
                   <td>
                       <input class="input_text notNullClass" name="ticketNo" maxlength="30" id="ticketNo"/>
                       <span class="red">*</span>
                   </td>
                   <th>出发地点/起始站：</th>
                   <td>
                       <input class="input_text notNullClass" name="departureStation" maxlength="60" id="departureStation"/>
                       <span class="red">*</span>
                   </td>
                </tr>
                <tr name = "ticketInfo" style="display:none;">
                   <th>到达地点/到达站：</th>
                   <td colspan='3'>
                       <input class="input_text notNullClass" name="arrivalStation" maxlength="60" id="arrivalStation" />
                       <span class="red">*</span>
                   </td>
                </tr>
                <tr>
                    <td colspan="4"
                        style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">投保人信息
                    </td>
                </tr>
                <tr>
                   <th>投保人姓名：</th>
                   <td>
                       <input class="input_text notNullClass" name="clientName1" id="clientName1"/>
                       <span class="red">*</span>
                   </td>
                   <th>投保人性质：</th>
                   <td>
                       <select name="appNature" id="appNature" onchange="changeTbrIdType()" style="width:180px;display:inline-block;border:1px solid #c3c3c3;">
                          	<option value="1">自然人</option>
							<option value="5">企业</option>
							<option value="7">其他社会团体</option>
							<option value="9">军队</option>
							<option value="10">外企</option>
							<option value="11">村委会</option>
                       </select>
                       <span class="red">*</span>
                </tr>
                <tr>
                   <th>证件类型：</th>
                   <td>
                       <select name="certificateType" id="certificateType" style="width:180px;display:inline-block;border:1px solid #c3c3c3;" >
                           <c:forEach var="idType" items="${idNature}">
                                    <option value="${idType.code}">${idType.codeName}</option>
                           </c:forEach>
                       </select>
                       <span class="red">*</span>
                   </td>
                   <th>证件号码：</th>
                   <td>
                       <input class="input_text notNullClass" name="certificateCode" maxlength="20" id="certificateCode"/>
                       <span class="red">*</span>
                   </td>
                </tr>
                <tr>
                   <th>出生日期：</th>
                   <td>
                       <input class="input_text notNullClass" name="clientBir1" readonly id="clientBir1" />
                       <span class="red" id="clientBir1Span">*</span>
                   </td>
                    <th>性别：</th>
                    <td><input type="radio"  style="cursor: pointer;" name="sex1" id="sexId1" onclick="hiddedView('sexId2')" value="1"/>男
                    <input type="radio"  style="cursor: pointer;"  name="sex1" id="sexId2" onclick="hiddedView('sexId2')" value="2"/>女
                    </td>
                </tr>
                <tr>
                    <th>手机号码：</th>
                    <td>
                        <input class="input_text notNullClass" name="linkmanTel1" id="linkmanTel1" />
                        <span class="red">*</span>
                    </td>
                    <th>电子邮箱：</th>
                    <td>
                        <input class="email1 input_text notNullClass" name="email1" autocomplete="off"/>
                    </td>
                </tr>
                <tr>
                    <th>投保人国籍：</th>
                    <td>
                        <select name="appNationality" id="appNationality" style="width:180px;display:inline-block;border:1px solid #c3c3c3;">
                            <c:forEach var="n" items="${nationalityList}">
                                <option value="${n.code}">${n.codeName}</option>
                            </c:forEach>
                        </select>
                        <span class="red" id="nationalitySpan">*</span>
                    </td>
                    <th>职业类别：</th>
                    <td colspan='3'><input id="workName" type="text" class="input_text" disabled >
                        <input type="button" class="input_button_1" id="" value="选择" onClick="openWorkDiv('0')" />
                        <input id="workId" type="hidden" />
                        <span class="workLevel red" style="margin-left:20px;"></span>
                    </td>
                </tr>
                <tr id='commonInsure'>
                    <th>与被保人关系：</th>
                    <td colspan='3'>
                        <select name="relWithInsured1" id="relWithInsured1" style="width:180px;display:inline-block;border:1px solid #c3c3c3;">
                            <c:forEach var="rela" items="${relaList}">
                            <option value="${rela.code}" >${rela.codeName}</option>
                            </c:forEach>
                        </select>
                        <span class="red">*</span>
                    </td>
                </tr>
            </tbody>
        </table>
        <div id="drivingShow" style="display:none">
            <table class="table_05 ">
                <tr>
                    <td colspan="4"
                        style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">被保人信息
                    </td>
                </tr>
                <tr>
                    <td colspan='4'>发生保险责任范围内的交通事故时驾驶或乘坐本保险合同载明的车辆内的人员</td>
                </tr>
            </table>
        </div>
        <div class="appInsuredClass">
         <table class="table_05 ">
          <tr>
              <td colspan="4"
                  style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">被保人信息
              </td>
          </tr>
          <tr>
            <th width="20%">被保人姓名：</th>
            <td width="23%"><input class="input_text notNullClass" name="clientName2" id="clientName2" />
                <span class="red">*</span>
            </td>
            <th width="22%">证件类型：</th>
            <td width="25%">
                <select name="idType" id="idType" style="width:180px;display:inline-block;border:1px solid #c3c3c3;" >
                    <c:forEach var="idType1" items="${idNature}">
                         <option value="${idType1.code}" >${idType1.codeName}</option>
                    </c:forEach>
                </select>
                <span class="red">*</span>
            </td>
        </tr>
        <tr >
            <th>证件号码：</th>
            <td><input class="input_text notNullClass" name="idNo" id="idNo"/>
                 <span class="red">*</span>
            </td>
            <th>出生日期：</th>
            <td> <input readonly class="input_text notNullClass" type="text" name="clientBir2" id="clientBir2" />
            </td>
        </tr>
        <tr>
            <th>性别：</th>
            <td><input type="radio" style="cursor: pointer;"  name="sex2" id="sexId3" onclick="hiddedView('sexId4')"   value="1"/>男
            <input type="radio"  style="cursor: pointer;"  name="sex2" id="sexId4" onclick="hiddedView('sexId4')"   value="2"/>女
            </td>
            <th>手机号码：</th>
            <td><input class="input_text" name="clientTel2" id="clientTel2" /></td>
        </tr>
        <tr>
            <th>被保人国籍：</th>
            <td>
                <select name="insNationality" id="insNationality" style="width:180px;display:inline-block;border:1px solid #c3c3c3;">
                    <c:forEach var="n" items="${nationalityList}">
                        <option value="${n.code}" >${n.codeName}</option>
                    </c:forEach>
                </select>
                <span class="red">*</span>
            </td>
            <th>职业类别：</th>
            <td><input id="workNameBbr" type="text" class="input_text" disabled >
                <input type="button" class="input_button_1" id="" value="选择" onClick="openWorkDiv('1')" />
                <input id="workIdBbr" type="hidden" />                
                <span class="workLevelBbr red" style="margin-left:20px;"></span>
            </td>
        </tr>
        </table>
       </div>
       <div id="bbrDiv">
           <table class="table_05">
               <tr>
                   <td colspan="4"
                     style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">受益人信息
                   </td>
               </tr>
               <tr>
               <td colspan="4">
                  &nbsp;受益人&nbsp;&nbsp;法定&nbsp;&nbsp;
               </td>
           </tr>
           </table>
        </div>
       <div align="center">
            <input class="input_button_3" name="" type="button"
                onclick="saveInfo()" value="确定">&nbsp;&nbsp; <input
                class="input_button_3" name="" type="button"
                onclick="closeCurrentDIV('addAppInfo')" value="取消">
       </div>
    </div>
      

    <div id="openCard" style="display: none; width: 50%;">
        <div class="table_title_div">
	        <table class="table_title" style='width: 100%; height: 20px;'>
	                <tr>
	                    <td width="10%"></td>
	                    <td width="80%" id="interfaceName"></td>
	                    <td width="10%" align="right"><img
	                        src="<%=path%>/images/closedown.gif" alt="关闭"
	                        onclick="closeCurrentDIV('openCard')" /></td>
	                </tr>
	         </table>
         </div>
         <div class="dialogTitle">
                                请输入批单投保其中一张卡号密码验证
        </div>
        <table id="addtempletTable" style="align:center;margin: 10px auto;border:0">
            <tbody>
                <tr>
                    <td>
                        <table id="coverageTable" class="content_table_1" border="0" align="center">
                            <tbody>
                                <tr style="text-align:center">
                                  <td width="40%" style="text-align:right;border-right:0px;">卡号：&nbsp;&nbsp;</td>
                                  <td width="60%" style="text-align:left"><input id="cardNo1" name="cardNo1" style="width: 200px" class="input_text" /></td>
                                </tr>
                                <tr style="text-align:center">
                                  <td width="40%" style="text-align:right;border-right:0px;">密码：&nbsp;&nbsp;</td>
                                  <td width="60%" style="text-align:left"><input type="password" id="password1" name="password1" style="width: 200px" class="input_text" /></td>
                                </tr>
                            </tbody>
                        </table>
                        
                    </td>
                </tr>
            </tbody>
        </table>
        <div align="center">
           <input class="input_button_3" name="" type="button" onclick="checkCardNo()" value="确定">&nbsp;&nbsp;
           <input class="input_button_3" name="" type="button" onclick="closeCurrentDIV('openCard')" value="取消">
        </div>
    </div>
</body>
</html>